package com.authine.cloudpivot.ext.domain.dto.base;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

/**
 * @author Administrator
 */
@Data
@Schema(  description = "Page")
public class Page {
    @Schema(  description = "pageIndex")
    private Integer pageIndex;
    @Schema(  description = "pageSize")
    private Integer pageSize;

    public String  limit(){
        if (pageIndex == null) {
            pageIndex =0;
        }
        if (pageSize == null) {
            pageSize = 10;
        }
        return String.format(" limit %s,%s", pageIndex > 0 ? (pageIndex-1 )* pageSize  : 0,  pageSize);
    }

}
